﻿using System;
using System.Collections.Generic;

namespace IcicleFramework.Components.Actions
{
    public class ActionData : IActionData
    {
        protected Dictionary<string, object> data;

        public Dictionary<string, object> Data { get { return data; } }

        public object this[string name]
        {
            get
            {
                if (Data.ContainsKey(name))
                {
                    return Data[name];
                }
                else
                {
                    return null;
                }
            }
        }

        public ActionData()
        {
            data = new Dictionary<string, object>(4);
        }

        public void AddData(string type, object dataObject)
        {
            if (!data.ContainsKey(type))
            {
                data.Add(type, dataObject);
            }
            else
            {
                data[type] = dataObject;
            }
        }

        public void ClearData()
        {
            data.Clear();
        }
    }
}
